package demo;

import junit.framework.Assert;

import com.zdekun.fastdfs.Blowfish;

/**
 * openfire加密密码的方式
 * 
 * @author sean
 * 
 */
public class Main {

	public static void main(String[] args) {

		// key就是ofProperty表中的passwordKey对应的值
		String key = "12345HABSDk4321";
		String plainPassword = "123456";
		Blowfish blowfish = new Blowfish(key);

		String encryptPassword = blowfish.encrypt(plainPassword);
		System.out.println("encryptPassword=" + encryptPassword);
		String decryptPassword = blowfish.decrypt(encryptPassword);

		// 验证解密后，还是原来的密码明文
		Assert.assertTrue(plainPassword.equals(decryptPassword));
	}

}
